package com.admin.controller;

import com.admin.entity.CopyRightStation;
import com.admin.service.ICopyRightStationService;
import com.bean.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/copyrightstation")
public class CopyRightStationController {
    @Autowired
    private ICopyRightStationService iCopyRightStationService;

    @RequestMapping("/addCopyRight")
    public ResponseBean insertCopyRightStation(CopyRightStation copyRightStation) {
        boolean f=iCopyRightStationService.save(copyRightStation);
        int code = f ? 200 : 500;
        return new ResponseBean(code, null, null);
    }

    @RequestMapping("/canleShouquan")
    public ResponseBean canleShouquan(int copyright_station_id) {
        boolean f = iCopyRightStationService.removeById(copyright_station_id);
        int code = f ? 200 : 500;
        return new ResponseBean(code, null, null);
    }

    @RequestMapping("/seeShouquanTime")
    public ResponseBean seeShouquanTime(int copyrightId) {
        CopyRightStation c = iCopyRightStationService.getById(copyrightId);
        int code = c == null ? 500 : 200;
        return new ResponseBean(code, 0, c);
    }
}
